package com.fc.mall.dao;

import com.fc.mall.dto.PmsGroupBuy;
import com.fc.mall.dto.PmsGroupBuyParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 自定义拼团Dao
 */
public interface PmsGroupBuyDao {


    /**
     * 获取拼团列表
     * @param params
     * @return
     */
    List<PmsGroupBuy> queryGroupBuy(@Param("queryParam") PmsGroupBuyParam params);

    List<PmsGroupBuy> queryGroupBuyByPromotionId(@Param("pid") Long pid);

    PmsGroupBuy selectByPrimaryKey(Long id);

    int updateByPrimaryKey(PmsGroupBuy record);

    int insert(PmsGroupBuy record);

    int deleteByPrimaryKey(Long id);

    int addProductForPromotion(@Param("promotionId") Long promotionId, @Param("pid") Long pid);

    Long getCountByPidFromPromotion(@Param("promotionId") Long promotionId, @Param("pid") Long pid);

    int removeProductForPromotion(@Param("promotionId") Long promotionId, @Param("pid") Long pid);

    Long calculateGroupBuyOrderCount(@Param("productGroupIds") List<Long> productGroupIds);

    Long calculateGroupBuyCount(@Param("productGroupIds") List<Long> productGroupIds);
}
